<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>搭建个人博客 | Tom's develop Blog</title><meta name="keywords" content="个人博客,personal blog,Hexo,Github pages"><meta name="author" content="Tom"><meta name="copyright" content="Tom"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta http-equiv="Cache-Control" content="no-transform"><meta http-equiv="Cache-Control" content="no-siteapp"><meta name="description" content="搭建个人博客">
<meta property="og:type" content="article">
<meta property="og:title" content="搭建个人博客">
<meta property="og:url" content="https://tomsworkspace.github.io/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/index.html">
<meta property="og:site_name" content="Tom&#39;s develop Blog">
<meta property="og:description" content="搭建个人博客">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper/搭建个人博客/cover.jpg">
<meta property="article:published_time" content="2019-11-13T08:36:37.000Z">
<meta property="article:modified_time" content="2020-11-23T14:32:22.941Z">
<meta property="article:author" content="Tom">
<meta property="article:tag" content="TOM">
<meta property="article:tag" content="个人博客">
<meta property="article:tag" content="personal blog">
<meta property="article:tag" content="Hexo">
<meta property="article:tag" content="Github pages">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper/搭建个人博客/cover.jpg"><link rel="shortcut icon" href="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avatar.png"><link rel="canonical" href="https://tomsworkspace.github.io/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="preconnect" href="//zz.bdstatic.com"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"><script>var GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: undefined,
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: {"limitCount":50,"languages":{"author":"作者: Tom","link":"链接: ","source":"来源: Tom's develop Blog","info":"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},
  ClickShowText: {"text":"富强,民主,文明,和谐,自由,平等,公正,法治,爱国,敬业,诚信,友善","fontSize":"15px"},
  lightbox: 'mediumZoom',
  Snackbar: undefined,
  justifiedGallery: {
    js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
    css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
  },
  isPhotoFigcaption: false,
  islazyload: true,
  isanchor: false
};

var saveToLocal = {
  set: function setWithExpiry(key, value, ttl) {
    const now = new Date()
    const expiryDay = ttl * 86400000
    const item = {
      value: value,
      expiry: now.getTime() + expiryDay,
    }
    localStorage.setItem(key, JSON.stringify(item))
  },

  get: function getWithExpiry(key) {
    const itemStr = localStorage.getItem(key)

    if (!itemStr) {
      return undefined
    }
    const item = JSON.parse(itemStr)
    const now = new Date()

    if (now.getTime() > item.expiry) {
      localStorage.removeItem(key)
      return undefined
    }
    return item.value
  }
}</script><script id="config_change">var GLOBAL_CONFIG_SITE = { 
  isPost: true,
  isHome: false,
  isHighlightShrink: false,
  isToc: true,
  postUpdate: '2020-11-23 22:32:22'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(function () {  window.activateDarkMode = function () {
    document.documentElement.setAttribute('data-theme', 'dark')
    if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
    }
  }
  window.activateLightMode = function () {
    document.documentElement.setAttribute('data-theme', 'light')
   if (document.querySelector('meta[name="theme-color"]') !== null) {
      document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
    }
  }
  const autoChangeMode = 'true'
  const t = saveToLocal.get('theme')
  if (autoChangeMode === '1') {
    const isDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches
    const isLightMode = window.matchMedia('(prefers-color-scheme: light)').matches
    const isNotSpecified = window.matchMedia('(prefers-color-scheme: no-preference)').matches
    const hasNoSupport = !isDarkMode && !isLightMode && !isNotSpecified
    if (t === undefined) {
      if (isLightMode) activateLightMode()
      else if (isDarkMode) activateDarkMode()
      else if (isNotSpecified || hasNoSupport) {
        const now = new Date()
        const hour = now.getHours()
        const isNight = hour <= 6 || hour >= 18
        isNight ? activateDarkMode() : activateLightMode()
      }
      window.matchMedia('(prefers-color-scheme: dark)').addListener(function (e) {
        if (saveToLocal.get('theme') === undefined) {
          e.matches ? activateDarkMode() : activateLightMode()
        }
      })
    } else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else if (autoChangeMode === '2') {
    const now = new Date()
    const hour = now.getHours()
    const isNight = hour <= 6 || hour >= 18
    if (t === undefined) isNight ? activateDarkMode() : activateLightMode()
    else if (t === 'light') activateLightMode()
    else activateDarkMode()
  } else {
    if (t === 'dark') activateDarkMode()
    else if (t === 'light') activateLightMode()
  }})()</script><meta name="generator" content="Hexo 5.2.0"></head><body><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="author-avatar"><img class="avatar-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avator.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">73</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">12</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url(/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/cover.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Tom's develop Blog</a></span><span id="menus"><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><span class="close" id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></span></span></nav><div id="post-info"><h1 class="post-title">搭建个人博客</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2019-11-13T08:36:37.000Z" title="发表于 2019-11-13 16:36:37">2019-11-13</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2020-11-23T14:32:22.941Z" title="更新于 2020-11-23 22:32:22">2020-11-23</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%85%B6%E4%BB%96/">其他</a></span></div><div class="meta-secondline"> <span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">4.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>13分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span><span class="post-meta-separator">|</span><span class="post-meta-commentcount"><i class="far fa-comments fa-fw post-meta-icon"></i><span class="post-meta-label">评论数:</span><a href="/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/#post-comment"><span class="gitalk-comment-count comment-count"></span></a></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p>对于常年需要学习新东西的人们，经常想把学过的一些东西整理一下。于是写博客就成了很多人整理自己学习过的东西的很好的方式。有人选择在一些成熟的平台上管理自己的博客，比如知乎，CSDN，简书这些平台。不过在别人的平台上写东西很容易受到各种限制，内容也有各种各样的要求。哪有比自己搭一个私人博客网站更炫酷（装*）的呢！！！！</p>
<p>哈哈，let’s go.</p>
<a id="more"></a>
<h2 id="一-效果展示"><a href="#一-效果展示" class="headerlink" title="一.效果展示"></a><strong>一.效果展示</strong></h2><p>经过特别简单的配置（大概几个小时），一个属于个人的博客网站就搭好了，可以开始更新自己的内容了，毕竟内容才是最重要的啊。</p>
<p>效果如下：</p>
<p><img src= "/img/loading.gif" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/result.jpg"></p>
<h2 id="二-前期准备"><a href="#二-前期准备" class="headerlink" title="二.前期准备"></a><strong>二.前期准备</strong></h2><p>经过总结前人的经验，我把搭建一个个人的博客分为大概三种可行的方案：<br>    第一种方案：搭建一个通过Github pages访问的博客网站。但是这样的话只能通过访问 <a target="_blank" rel="noopener" href="http://github用户名.github.io的方式访问自己的博客网站,毕竟不够炫酷,但是是免费的.于是有了第二种方案./">http://github用户名.github.io的方式访问自己的博客网站，毕竟不够炫酷，但是是免费的。于是有了第二种方案。</a><br>    第二种方案：把 <a target="_blank" rel="noopener" href="http://github用户名.github.io绑定到自己的域名,购买一个域名需要一定的费用./">http://github用户名.github.io绑定到自己的域名，购买一个域名需要一定的费用。</a><br>    第三种方案：把博客系统放到自己购买服务器上，这样能通过服务器的IP地址访问博客网站，绑定域名后可以通过域名来访问。这是最炫酷的方式，当然也是pay最多的，而且网站还需要经过备案。</p>
<p>由于自己热爱open sourse（其实是没钱），于是我选择了第一种的方案。希望后面有钱了可以实现第三种方案。哈哈。</p>
<h3 id="2-1-选择一个博客框架"><a href="#2-1-选择一个博客框架" class="headerlink" title="2.1 选择一个博客框架"></a>2.1 选择一个博客框架</h3><p>为了避免重复造轮子，也为了简单和高效起见，我们需要选择一个已有的博客框架，再在这些框架的基础上搭建。有很多还不错的<a target="_blank" rel="noopener" href="https://www.oschina.net/project/tag/65/blog">开源博客框架</a>可以选择。简单列举几个：<br>    - <a target="_blank" rel="noopener" href="https://jekyllrb.com/">Jekyll</a><br>    - <a target="_blank" rel="noopener" href="http://www.gohugo.org/">hugo</a><br>    - <a target="_blank" rel="noopener" href="https://www.djangoproject.com/">django</a><br>    - <a target="_blank" rel="noopener" href="https://hexo.io/">hexo</a></p>
<p>经过比较，发现hexo框架还不错，有比较好的扩展性和很大的用户基础。于是Tom就选了hexo作为博客的框架。想选择其他框架的请参照具体官网文档,和他们的GitHub issues。</p>
<h3 id="2-2-hexo框架的简介"><a href="#2-2-hexo框架的简介" class="headerlink" title="2.2 hexo框架的简介"></a>2.2 hexo框架的简介</h3><p><strong>Hexo 特点</strong></p>
<ul>
<li>支持Markdown: 支持Markdown意味着你可以把经历从排版中解放出来</li>
<li>轻量: 无需拥有后台及数据库,专心写好你的文章    </li>
<li>一键部署: 可以通过Git或者ftp来将生成的静态页面部署到服务器或者主机空间中    </li>
<li>插件丰富: 丰富的插件可以满足你的各种需求</li>
</ul>
<p>其他特性，请参考<a target="_blank" rel="noopener" href="https://hexo.io/">官方文档</a>.</p>
<h3 id="2-3-配置必要的环境"><a href="#2-3-配置必要的环境" class="headerlink" title="2.3 配置必要的环境"></a>2.3 配置必要的环境</h3><p>搭建前期需要四个工具</p>
<ul>
<li>Hexo:Hexo快速、简洁且高效的博客框架</li>
<li>Node.js:建立在Chrome上的JavaScript运行引擎</li>
<li>Git:一款免费、开源的分布式版本控制系统</li>
<li>GitHub:国内一款面向开发者的云端开发平台，提供代码托管，运行空间，质量控制，项目管理等功能<br>安装</li>
</ul>
<p>安装必要的配置环境，如果已经安装过，可以跳过。</p>
<h4 id="2-3-1-安装Git-Git官网"><a href="#2-3-1-安装Git-Git官网" class="headerlink" title="2.3.1 安装Git Git官网"></a>2.3.1 安装Git <a target="_blank" rel="noopener" href="https://git-scm.com/">Git官网</a></h4><p>找到Download,安装自己对应的系统版本，系统会自动判定你当前版本，推荐下载，如果没有推荐，那就自己选择吧。</p>
<p>安装完后，用win+R打开cmd界面，输入</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$git</span> --version</span><br></pre></td></tr></table></figure>

<p>出现git的版本信息说明安装成功。</p>
<p>然后熟悉一下<a target="_blank" rel="noopener" href="https://blog.csdn.net/WeDeserveIt/article/details/79645195">Git管理Github项目</a>的常用命令，理解一下他们的关系,感受一下git版本和分支管理的强大之处。</p>
<h4 id="2-3-2-安装Node-js-Node-js下载地址"><a href="#2-3-2-安装Node-js-Node-js下载地址" class="headerlink" title="2.3.2 安装Node.js Node.js下载地址"></a>2.3.2 安装Node.js <a target="_blank" rel="noopener" href="https://nodejs.org/en/">Node.js下载地址</a></h4><p>安装node.js记得选择add to path选项，或者手动<a href="">配置环境变量</a>。把node所在的bin目录加入环境变量。用win+R打开cmd界面，输入</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$node</span>	</span><br></pre></td></tr></table></figure>

<p>出现node.js的版本信息说明安装成功。</p>
<p>同理系统依然会判定你的系统并给出稳定推荐的版本和尝鲜版，两种，供君选择。下载安装步骤同样省略。</p>
<h4 id="2-3-3-GitHub账号注册"><a href="#2-3-3-GitHub账号注册" class="headerlink" title="2.3.3 GitHub账号注册"></a>2.3.3 GitHub账号注册</h4><p>GitHub账号<a target="_blank" rel="noopener" href="https://www.cnblogs.com/zytrue/p/8619723.html">注册过程</a>很简单，注册流程就省略，完成之后，就开始创建博客了。注册完成后，创建名字为 username.github.io 的仓库,username是你的github用户名。记住一定是这个名字的仓库，不然会出问题的。</p>
<h4 id="2-3-4-安装Hexo"><a href="#2-3-4-安装Hexo" class="headerlink" title="2.3.4 安装Hexo"></a>2.3.4 <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/setup">安装Hexo</a></h4><p>前面的所有工具安装完成后，在git bash或者cmd界面中使用npm安装hexo。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$npm</span> install -g hexo-cli</span><br></pre></td></tr></table></figure>

<p>进阶安装和使用,对于熟悉 npm 的进阶用户，可以仅局部安装 hexo 包。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$npm</span> install hexo</span><br></pre></td></tr></table></figure>

<p>安装 Hexo 完成后，请执行下列命令查看安装hexo的版本信息。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> version</span><br></pre></td></tr></table></figure>

<p>然后运行以下命令，Hexo 将会在指定文件夹中新建所需要的文件。这个指定的文件夹就是保存你的博客站点所有文件的地方。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> init &lt;folder&gt;</span><br><span class="line"><span class="variable">$cd</span> &lt;folder&gt;	</span><br><span class="line"><span class="variable">$npm</span> install	</span><br></pre></td></tr></table></figure>

<p>站点文件包含以下的文件</p>
<pre><code>.
├── _config.yml  //网站的配置文件
├── package.json //应用程序的信息
├── scaffolds    //模版 文件夹。当您新建文章时，Hexo 会根据 scaffold 来建立文件。
├── source       //资源文件夹是存放用户资源的地方。除 _posts 文件夹之外，开头命名为 _ (下划线)的文件 / 文件夹和隐藏的文件将会被忽略。Markdown 和 HTML 文件会被解析并放到 public 文件夹，而其他文件会被拷贝过去。
|   ├── _drafts
|   └── _posts
└── themes       //主题 文件夹。Hexo 会根据主题来生成静态页面。</code></pre>
<p><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/configuration">更多关于站点目录和配置文件的信息。</a></p>
<p>安装git,hexo，node.js后，熟悉<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/commands">相关命令</a>。不同系统环境下安装遇到的问题请参考<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">官方文档</a>,官方文档支持中英文，很方便。</p>
<h2 id="三-hexo框架搭建博客"><a href="#三-hexo框架搭建博客" class="headerlink" title="三.hexo框架搭建博客"></a><strong>三.hexo框架搭建博客</strong></h2><h3 id="3-1-建立hexo项目，本地localhost-port访问"><a href="#3-1-建立hexo项目，本地localhost-port访问" class="headerlink" title="3.1 建立hexo项目，本地localhost:port访问"></a>3.1 建立hexo项目，本地localhost:port访问</h3><p>在上一步生成了站点文件夹后，其中会有一个默认主题以及一个hello-word的默认文章。所以我们可以先生成博客来看一下效果，在站点所在目录打开git bash运行命令：</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> generate  //可以简写成<span class="variable">$hexo</span> g</span><br></pre></td></tr></table></figure>

<p>然后hexo会开始生成博客，生成结束后，文件夹下会多出一个public的文件夹，这个文件夹就是hexo生成的一个完整的静态网站，也就是我们的博客。网站生成好了，我们要浏览它，所以要开启一下hexo自带的服务器，运行命令：</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> server  //可以简写成<span class="variable">$hexo</span> s</span><br></pre></td></tr></table></figure>

<p>这时候，打开浏览器，输入localhost：4000即可访问博客网站。<br>如果出现端口冲突，可以使用如下的命令指定其他端口。再使用localhost：port去访问。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> server -p port //可以简写成<span class="variable">$hexo</span> g -p port</span><br></pre></td></tr></table></figure>

<h3 id="3-2-远程部署，绑定SSH-域名访问"><a href="#3-2-远程部署，绑定SSH-域名访问" class="headerlink" title="3.2 远程部署，绑定SSH,域名访问"></a>3.2 远程部署，绑定SSH,域名访问</h3><p>远程部署指的是，博客在我们本地生成好了以后部署到远程仓库去，如果远程仓库支持pages服务的话，那就可以通过这样的方法发布和更新博客。<br>要使用远程部署需要先安装hexo-deployer-git，注意，这是适用于git类型仓库的方法，其他仓库的方法在<a target="_blank" rel="noopener" href="https://hexo.io/">官网</a>中有说明。</p>
<p>运行命令</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$npm</span> install hexo-deployer-git --save  //安装hexo-deployer-git package</span><br></pre></td></tr></table></figure>

<p>安装好hexo-deployer-git后，修改博客目录配置文件_config.yml中的deploy字段，用记事本打开就可以：</p>
<pre><code>deploy:
  type: git //pages 部署仓库类型
  repo:     //git仓库项目地址，你建立的 用户名.github.io仓库
  branch:   //分支，默认是master
  message:  //自定义提交说明，这个字段可以没有，用于描述你的提交</code></pre>
<p>再运行</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> deploy</span><br></pre></td></tr></table></figure>
<p>打开github的repo,发现你的仓库里已经有了文件，这是生成的博客网站的静态文件。也就是本地博客文件夹中的public 或者.deploy_git中的内容。hexo生成了你的博客网站的静态文件。在浏览器地址栏输入<a target="_blank" rel="noopener" href="http://username.github.io就可以访问你的个人博客网站了.很炫酷吧./">http://username.github.io就可以访问你的个人博客网站了。很炫酷吧。</a></p>
<p>参考的一些资料    </p>
<p><a target="_blank" rel="noopener" href="https://www.cnblogs.com/liuxianan/p/build-blog-website-by-hexo-github.html">https://www.cnblogs.com/liuxianan/p/build-blog-website-by-hexo-github.html</a><br><a target="_blank" rel="noopener" href="https://blog.csdn.net/gsl9d1p04f6x2ts3c9/article/details/81024330">https://blog.csdn.net/gsl9d1p04f6x2ts3c9/article/details/81024330</a><br><a target="_blank" rel="noopener" href="https://blog.csdn.net/dazhaoDai/article/details/73730069">https://blog.csdn.net/dazhaoDai/article/details/73730069</a><br><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/343934573342">https://www.jianshu.com/p/343934573342</a></p>
<p><strong>绑定SSH</strong></p>
<p>Git使用https协议，每次pull, push都要输入密码，相当的烦。使用git协议，然后使用ssh密钥。这样可以省去每次都输密码。为了方便你的博客的提交，你可以进行git与repo仓库的SSH绑定。</p>
<p>SSH绑定git仓库的特点：</p>
<ul>
<li>ssh方式单独使用非对称的秘钥进行认证和加密传输，和账号密码分离开来，不需要账号也可以访问repo。</li>
<li>生成和管理秘钥有点繁琐，需要管理员添加成员的public key。不能进行匿名访问，ssh不利于对权限进行细分，用户必须具有通过SSH协议访问你主机的权限，才能进行下一步操作，比较适合内部项目。</li>
</ul>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/ShuTongIt/article/details/89165054">如何进行SSH配置。</a></p>
<h2 id="四-更换主题"><a href="#四-更换主题" class="headerlink" title="四.更换主题"></a><strong>四.更换主题</strong></h2><h3 id="4-1-给你的博客选择一个主题"><a href="#4-1-给你的博客选择一个主题" class="headerlink" title="4.1 给你的博客选择一个主题"></a>4.1 给你的博客选择一个主题</h3><p>经过以上的配置，你的博客网站已经跑起来了。不过是不是有点丑呢？看来需要进一步的美化我们的网站啊。当然Hexo,也大力支持我们的想法，Hexo提供了很多漂亮的主题供我们选择。<a target="_blank" rel="noopener" href="https://hexo.io/themes/">Hexo主题</a>。是不是发现有很多主题让你眼花缭乱了，如果不知道应该选哪一个，可以听一听来自前人的建议<a target="_blank" rel="noopener" href="https://blog.csdn.net/zgd826237710/article/details/99671027">主题推荐1</a> <a target="_blank" rel="noopener" href="https://blog.csdn.net/fail_perfectly/article/details/83791781">主题推荐2</a>。</p>
<h3 id="4-2-更改相关配置"><a href="#4-2-更改相关配置" class="headerlink" title="4.2 更改相关配置"></a>4.2 更改相关配置</h3><p>找到自己喜欢的主题，把对应的主题下载到本地站点文件夹下的themes文件夹下。Tom选择了一个名为<a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a>的主题。想要让这个主题应用到我自己的站点上。需要进行如下的操作。</p>
<p><strong>下载主题</strong></p>
<p>找到下载主题的Github repo地址，在站点文件夹下右键打开git bash,输入命令</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$git</span> <span class="built_in">clone</span> -b master https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly</span><br></pre></td></tr></table></figure>

<p>如果想要安装比较新的dev分支，可以</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$git</span> <span class="built_in">clone</span> -b dev https://github.com/jerryc127/hexo-theme-butterfly.git themes/Butterfly</span><br></pre></td></tr></table></figure>

<p><strong>应用主题</strong></p>
<p>修改hexo配置文件_config.yml，把主题改为Butterfly</p>
<pre><code>theme: Butterfly</code></pre>
<p>对于不同的主题，可能还有其他的配置才能生效，参加你选择主题的相关文档说明，关于主题<a target="_blank" rel="noopener" href="https://jerryc.me/posts/21cfbf15/#%E6%96%87%E7%AB%A0%E7%9B%B8%E9%97%9C%E9%A0%85">Butterfly配置</a>。</p>
<p>如果你没有pug以及stylus的渲染器，请下载安装： </p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$npm</span> install hexo-renderer-pug hexo-renderer-stylus --save </span><br></pre></td></tr></table></figure>

<p>或者</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$yarn</span> add hexo-renderer-pug hexo-renderer-stylus</span><br></pre></td></tr></table></figure>

<p>然后再次generate ,depoly，访问地址，主题就更换好了。</p>
<p><a target="_blank" rel="noopener" href="https://hexo.io/docs/troubleshooting">疑难问题解决</a></p>
<h2 id="五-项目管理"><a href="#五-项目管理" class="headerlink" title="五.项目管理"></a><strong>五.项目管理</strong></h2><h3 id="5-1-写博客，删除博客"><a href="#5-1-写博客，删除博客" class="headerlink" title="5.1 写博客，删除博客"></a>5.1 写博客，删除博客</h3><p>首先，由于hexo是支持Markdown来编写你的博客的，非常方便。<a target="_blank" rel="noopener" href="http://www.markdown.cn/#overview">markdown语法</a>也是非常简单的，类似于html,很快就能掌握。在开始写你的博客之前需要先掌握一下。</p>
<p>但是在实际使用时发现了一个问题。在不同的平台对于markdown语法的支持不太一样，但是大多是东西是一样的，对于博客在不同平台间的迁移不太方便。暂时没有太好的解决办法，等有比较好的解决方法时更新一下。hexo支持的markdown 语法和github的markdown语法是一样的。然后最好是选择一个对于<a target="_blank" rel="noopener" href="https://daringfireball.net/projects/markdown/syntax">hexo markdown语法</a>支持得比较好的<a target="_blank" rel="noopener" href="https://www.jianshu.com/p/5fc306ca28cf">makedown编辑器</a>。</p>
<p>其他的markdown语法资料<br>    <a target="_blank" rel="noopener" href="https://segmentfault.com/markdown">https://segmentfault.com/markdown</a><br>    <a target="_blank" rel="noopener" href="https://www.jianshu.com/p/8c1b2b39deb0">https://www.jianshu.com/p/8c1b2b39deb0</a></p>
<h3 id="5-2-上传更新博客"><a href="#5-2-上传更新博客" class="headerlink" title="5.2 上传更新博客"></a>5.2 上传更新博客</h3><p>先在本地预览一下写好的博客，在站点文件夹下使用git bash运行</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> generate //hexo g</span><br><span class="line"><span class="variable">$hexo</span> server //hexo s</span><br></pre></td></tr></table></figure>

<p>检查没问题后，提交更新</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$hexo</span> deploy //hexo d</span><br></pre></td></tr></table></figure>

<h2 id="六-高级功能"><a href="#六-高级功能" class="headerlink" title="六.高级功能"></a><strong>六.高级功能</strong></h2><h3 id="6-1-评论管理"><a href="#6-1-评论管理" class="headerlink" title="6.1 评论管理"></a>6.1 评论管理</h3><p>如何给我们的评论添加评论功能呢？</p>
<p>以Tom选择的Butterfly主题为例，打开主题的配置文件夹_config.yml,注意不是站点的配置文件。搜索Comments,发现该主题支持如下的几种评论系统</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://disqus.com/">disqus</a></li>
<li><a target="_blank" rel="noopener" href="https://livere.com/">laibili</a></li>
<li><a target="_blank" rel="noopener" href="https://github.com/gitalk">gitalk</a></li>
<li><a target="_blank" rel="noopener" href="https://valine.js.org/">valine</a></li>
</ul>
<p>可以任选一种评论系统进行配置。大致流程为先注册对应的评论系统，再进行一些配置。主题Butterfly相关配置参见主题<a target="_blank" rel="noopener" href="https://jerryc.me/posts/21cfbf15/#%E8%A9%95%E8%AB%96">butterfly相关文档</a>。</p>
<p><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/02bb9eaa0f51">其他的配置方法</a>。</p>
<h3 id="6-2-绑定域名"><a href="#6-2-绑定域名" class="headerlink" title="6.2 绑定域名"></a>6.2 <a target="_blank" rel="noopener" href="https://www.cnblogs.com/zhangqie/p/7978394.html">绑定域名</a></h3><p>是不是感觉使用githubusername.github.io访问自己的博客还是不够炫酷呢？于是可以给自己的网站绑定一个炫酷的域名，也就是相当于给你的网站起了一个别名，本质上都是通过DNS查找ip地址，然后通过IP地址访问的你的网站的。</p>
<p>可以在CMD界面下通过命令来查看你博客的ip地址。</p>
<figure class="highlight bash"><table><tr><td class="code"><pre><span class="line"><span class="variable">$ping</span> username.github.io  //ping 你的博客网址</span><br></pre></td></tr></table></figure>
<p>首先注册一个域名，在阿里云上注册或者买一个域名。打开控制台，点击解析域名，把你刚刚查到的ip地址填到刚刚解析的域名的记录值上面。然后在你的博客文件夹下面新建一个名为CNAME的文件，在里面写入你刚刚购买的域名。然后提交你的站点静态文件到仓库里。等待一段时间，然后就可以通过刚刚购买的域名访问你的网站了。</p>
<h3 id="6-3-部署站点到自己的服务器"><a href="#6-3-部署站点到自己的服务器" class="headerlink" title="6.3 部署站点到自己的服务器"></a>6.3 部署站点到自己的服务器</h3><p>如果你觉得上面的配置还不过炫酷，速度不够快，毕竟github是国外的网站，那么还有更厉害的，把网站放到自己的服务器上。</p>
<p><strong>网站备案</strong></p>
<p>首先，需要进行网站备案。根据工信部《互联网信息服务管理办法》(国务院 292 号令)，网站在未完成备案之前，不能指向大陆境内服务器开通访问。如果您的网站托管在中国大陆节点服务器，或者开通 CDN 服务，就必须申请 ICP(互联网内容提供商)备案。若网站服务器为非中国大陆节点，则不用申请备案。</p>
<p>然后购买一个服务器，把你的域名绑定到你的服务器上。</p>
<p>在你的服务器上安装Git并配置,安装并搭建web容器，如nginx,Tomcat等。</p>
<p>然后服务器获取站点静态文件有两种方式：</p>
<ul>
<li><a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_35561857/article/details/81590953">通过把站点静态文件直接提交到服务器上的git仓库</a></li>
<li><a target="_blank" rel="noopener" href="https://www.weipxiu.com/4103.html">通过从github上的username.github.io获取站点静态文件</a></li>
</ul>
<p>这样就完成了最后的配置。</p>
<h3 id="6-4-更换电脑或重装系统后恢复hexo"><a href="#6-4-更换电脑或重装系统后恢复hexo" class="headerlink" title="6.4 更换电脑或重装系统后恢复hexo"></a>6.4 更换电脑或重装系统后恢复hexo</h3><p>当我们的系统崩溃或者是其他原因导致hexo不能用了，<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_34187711/article/details/88592760">试试这个恢复</a>。</p>
<h3 id="6-5-配置一键部署："><a href="#6-5-配置一键部署：" class="headerlink" title="6.5 配置一键部署："></a>6.5 配置一键部署：</h3><p>每次更新博客都需要进到博客站点下进行操作，还有一堆的命令要输入。<a target="_blank" rel="noopener" href="https://blog.csdn.net/qq_34187711/article/details/88592760">配置一键部署</a>。</p>
<h3 id="6-6-自定义"><a href="#6-6-自定义" class="headerlink" title="6.6 自定义"></a>6.6 自定义</h3><p>什么？ 你觉得所有的主题都不符合你的要求。没问题，hexo也支持你自己<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/themes">DIY主题</a>，还可以发布给大家一起用。还支持<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/templates">自定义博客模板</a>等功能。</p>
<h3 id="6-7-博客迁移"><a href="#6-7-博客迁移" class="headerlink" title="6.7 博客迁移"></a>6.7 博客迁移</h3><p>你想把自己博客发布到不同的平台上，或者是从其他平台上添加自己的博客。没问题，hexo也支持。试试<a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/migration">博客迁移</a>。</p>
<h3 id="6-8-搜索引擎收录博客"><a href="#6-8-搜索引擎收录博客" class="headerlink" title="6.8 搜索引擎收录博客"></a>6.8 搜索引擎收录博客</h3><p>当我们一开始建完博客时，搜索引擎是搜索不到的，我们需要做一项工作就是通知搜索引擎收录我们的网站。</p>
<p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qw8880000/article/details/80235665">具体方法</a></p>
<h3 id="6-9-jsDelivr免费CDN加速博客"><a href="#6-9-jsDelivr免费CDN加速博客" class="headerlink" title="6.9 jsDelivr免费CDN加速博客"></a>6.9 jsDelivr免费CDN加速博客</h3><p>由于github的服务器是国外的服务器，访问速度相对较慢，特别是你的博客中使用了太多的图片等比较大的资源，这时候可以使用CDN加速给网站很快的访问速度。</p>
<p><a href="https://tomsworkspace.github.io/2020/01/15/%E4%BD%BF%E7%94%A8%E5%85%8D%E8%B4%B9CDN%E6%9C%8D%E5%8A%A1%E5%8A%A0%E9%80%9FGithub%E5%8D%9A%E5%AE%A2/">具体方法</a></p>
<h2 id="七-出现的一些问题"><a href="#七-出现的一些问题" class="headerlink" title="七.出现的一些问题"></a>七.出现的一些问题</h2><h3 id="git-ssh配置Host-key-verification-failed"><a href="#git-ssh配置Host-key-verification-failed" class="headerlink" title="git ssh配置Host key verification failed."></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/ren593669257/article/details/88862681">git ssh配置Host key verification failed.</a></h3><h3 id="YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-line-5-column"><a href="#YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-line-5-column" class="headerlink" title="YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 5, column "></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/wangyuehan/p/9864830.html">YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 5, column </a></h3><h3 id="bad-indentation-of-a-mapping-entry-at-line-199-column-2"><a href="#bad-indentation-of-a-mapping-entry-at-line-199-column-2" class="headerlink" title="bad indentation of a mapping entry at line 199, column 2:"></a><a target="_blank" rel="noopener" href="https://www.cnblogs.com/Anderson-An/p/9962841.html">bad indentation of a mapping entry at line 199, column 2:</a></h3><h3 id="hexo-YAMLException-cannot-read-a-block-mapping-entry-a-multi-line-key-may-not-be-an-implicit-key-a"><a href="#hexo-YAMLException-cannot-read-a-block-mapping-entry-a-multi-line-key-may-not-be-an-implicit-key-a" class="headerlink" title="hexo YAMLException: cannot read a block mapping entry; a multi line key may not be an implicit key a"></a><a target="_blank" rel="noopener" href="https://blog.csdn.net/dongwuming/article/details/49639243">hexo YAMLException: cannot read a block mapping entry; a multi line key may not be an implicit key a</a></h3><h3 id="gitalk-出现not-found-等问题"><a href="#gitalk-出现not-found-等问题" class="headerlink" title="gitalk 出现not found 等问题"></a><a target="_blank" rel="noopener" href="https://www.jianshu.com/p/b4ca8e7c7980">gitalk 出现not found 等问题</a></h3><p>深坑，申请gitalk账号一般不会出问题，一般问题出在配置_config.yml上。注意repo是只写仓库名字，不是全部路径啊。如username.github.io这样。</p>
<h3 id="butterfly主题问题解答"><a href="#butterfly主题问题解答" class="headerlink" title="butterfly主题问题解答"></a><a target="_blank" rel="noopener" href="https://jerryc.me/posts/21cfbf15/#Q-amp-A">butterfly主题问题解答</a></h3><h3 id="更多问题解答"><a href="#更多问题解答" class="headerlink" title="更多问题解答"></a><a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/troubleshooting">更多问题解答</a></h3></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">文章作者: </span><span class="post-copyright-info"><a href="mailto:undefined">Tom</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">文章链接: </span><span class="post-copyright-info"><a href="https://tomsworkspace.github.io/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">https://tomsworkspace.github.io/2019/11/13/%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank">CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://TOMsworkspace.github.io" target="_blank">Tom's develop Blog</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/TOM/">TOM</a><a class="post-meta__tags" href="/tags/%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/">个人博客</a><a class="post-meta__tags" href="/tags/personal-blog/">personal blog</a><a class="post-meta__tags" href="/tags/Hexo/">Hexo</a><a class="post-meta__tags" href="/tags/Github-pages/">Github pages</a></div><div class="post_share"><div class="social-share" data-image="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper/搭建个人博客/cover.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i> 打赏<div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/wp.jpg" target="_blank"><img class="post-qr-code-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/wp.jpg" alt="wechat"/></a><div class="post-qr-code-desc">wechat</div></li></ul></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-full"><a href="/2019/11/17/CPU-Cache/"><img class="prev-cover" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper/CPU-Cache/cover.png" onerror="onerror=null;src='/img/404.jpg'"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">CPU Cache</div></div></a></div></nav><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="gitalk-container"></div></div></div></div></div><div class="aside_content" id="aside_content"><div class="card-widget card-info"><div class="card-content"><div class="card-info-avatar is-center"><img class="avatar-img" data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/BlogHelper@1.0/avator.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/><div class="author-info__name">Tom</div><div class="author-info__description">keep curiously!</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">73</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">12</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/TOMsworkspace"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/TOMsworkspace" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:cqucscw@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div></div><div class="card-widget card-announcement"><div class="card-content"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">This is my Blog</div></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="card-content"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%80-%E6%95%88%E6%9E%9C%E5%B1%95%E7%A4%BA"><span class="toc-text">一.效果展示</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%8C-%E5%89%8D%E6%9C%9F%E5%87%86%E5%A4%87"><span class="toc-text">二.前期准备</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#2-1-%E9%80%89%E6%8B%A9%E4%B8%80%E4%B8%AA%E5%8D%9A%E5%AE%A2%E6%A1%86%E6%9E%B6"><span class="toc-text">2.1 选择一个博客框架</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-2-hexo%E6%A1%86%E6%9E%B6%E7%9A%84%E7%AE%80%E4%BB%8B"><span class="toc-text">2.2 hexo框架的简介</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#2-3-%E9%85%8D%E7%BD%AE%E5%BF%85%E8%A6%81%E7%9A%84%E7%8E%AF%E5%A2%83"><span class="toc-text">2.3 配置必要的环境</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3-1-%E5%AE%89%E8%A3%85Git-Git%E5%AE%98%E7%BD%91"><span class="toc-text">2.3.1 安装Git Git官网</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3-2-%E5%AE%89%E8%A3%85Node-js-Node-js%E4%B8%8B%E8%BD%BD%E5%9C%B0%E5%9D%80"><span class="toc-text">2.3.2 安装Node.js Node.js下载地址</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3-3-GitHub%E8%B4%A6%E5%8F%B7%E6%B3%A8%E5%86%8C"><span class="toc-text">2.3.3 GitHub账号注册</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#2-3-4-%E5%AE%89%E8%A3%85Hexo"><span class="toc-text">2.3.4 安装Hexo</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%89-hexo%E6%A1%86%E6%9E%B6%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2"><span class="toc-text">三.hexo框架搭建博客</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#3-1-%E5%BB%BA%E7%AB%8Bhexo%E9%A1%B9%E7%9B%AE%EF%BC%8C%E6%9C%AC%E5%9C%B0localhost-port%E8%AE%BF%E9%97%AE"><span class="toc-text">3.1 建立hexo项目，本地localhost:port访问</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#3-2-%E8%BF%9C%E7%A8%8B%E9%83%A8%E7%BD%B2%EF%BC%8C%E7%BB%91%E5%AE%9ASSH-%E5%9F%9F%E5%90%8D%E8%AE%BF%E9%97%AE"><span class="toc-text">3.2 远程部署，绑定SSH,域名访问</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9B%9B-%E6%9B%B4%E6%8D%A2%E4%B8%BB%E9%A2%98"><span class="toc-text">四.更换主题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#4-1-%E7%BB%99%E4%BD%A0%E7%9A%84%E5%8D%9A%E5%AE%A2%E9%80%89%E6%8B%A9%E4%B8%80%E4%B8%AA%E4%B8%BB%E9%A2%98"><span class="toc-text">4.1 给你的博客选择一个主题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#4-2-%E6%9B%B4%E6%94%B9%E7%9B%B8%E5%85%B3%E9%85%8D%E7%BD%AE"><span class="toc-text">4.2 更改相关配置</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%BA%94-%E9%A1%B9%E7%9B%AE%E7%AE%A1%E7%90%86"><span class="toc-text">五.项目管理</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#5-1-%E5%86%99%E5%8D%9A%E5%AE%A2%EF%BC%8C%E5%88%A0%E9%99%A4%E5%8D%9A%E5%AE%A2"><span class="toc-text">5.1 写博客，删除博客</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#5-2-%E4%B8%8A%E4%BC%A0%E6%9B%B4%E6%96%B0%E5%8D%9A%E5%AE%A2"><span class="toc-text">5.2 上传更新博客</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%85%AD-%E9%AB%98%E7%BA%A7%E5%8A%9F%E8%83%BD"><span class="toc-text">六.高级功能</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#6-1-%E8%AF%84%E8%AE%BA%E7%AE%A1%E7%90%86"><span class="toc-text">6.1 评论管理</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-2-%E7%BB%91%E5%AE%9A%E5%9F%9F%E5%90%8D"><span class="toc-text">6.2 绑定域名</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-3-%E9%83%A8%E7%BD%B2%E7%AB%99%E7%82%B9%E5%88%B0%E8%87%AA%E5%B7%B1%E7%9A%84%E6%9C%8D%E5%8A%A1%E5%99%A8"><span class="toc-text">6.3 部署站点到自己的服务器</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-4-%E6%9B%B4%E6%8D%A2%E7%94%B5%E8%84%91%E6%88%96%E9%87%8D%E8%A3%85%E7%B3%BB%E7%BB%9F%E5%90%8E%E6%81%A2%E5%A4%8Dhexo"><span class="toc-text">6.4 更换电脑或重装系统后恢复hexo</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-5-%E9%85%8D%E7%BD%AE%E4%B8%80%E9%94%AE%E9%83%A8%E7%BD%B2%EF%BC%9A"><span class="toc-text">6.5 配置一键部署：</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-6-%E8%87%AA%E5%AE%9A%E4%B9%89"><span class="toc-text">6.6 自定义</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-7-%E5%8D%9A%E5%AE%A2%E8%BF%81%E7%A7%BB"><span class="toc-text">6.7 博客迁移</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-8-%E6%90%9C%E7%B4%A2%E5%BC%95%E6%93%8E%E6%94%B6%E5%BD%95%E5%8D%9A%E5%AE%A2"><span class="toc-text">6.8 搜索引擎收录博客</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#6-9-jsDelivr%E5%85%8D%E8%B4%B9CDN%E5%8A%A0%E9%80%9F%E5%8D%9A%E5%AE%A2"><span class="toc-text">6.9 jsDelivr免费CDN加速博客</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%83-%E5%87%BA%E7%8E%B0%E7%9A%84%E4%B8%80%E4%BA%9B%E9%97%AE%E9%A2%98"><span class="toc-text">七.出现的一些问题</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#git-ssh%E9%85%8D%E7%BD%AEHost-key-verification-failed"><span class="toc-text">git ssh配置Host key verification failed.</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#YAMLException-can-not-read-a-block-mapping-entry-a-multiline-key-may-not-be-an-implicit-key-at-line-5-column"><span class="toc-text">YAMLException: can not read a block mapping entry; a multiline key may not be an implicit key at line 5, column </span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#bad-indentation-of-a-mapping-entry-at-line-199-column-2"><span class="toc-text">bad indentation of a mapping entry at line 199, column 2:</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#hexo-YAMLException-cannot-read-a-block-mapping-entry-a-multi-line-key-may-not-be-an-implicit-key-a"><span class="toc-text">hexo YAMLException: cannot read a block mapping entry; a multi line key may not be an implicit key a</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#gitalk-%E5%87%BA%E7%8E%B0not-found-%E7%AD%89%E9%97%AE%E9%A2%98"><span class="toc-text">gitalk 出现not found 等问题</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#butterfly%E4%B8%BB%E9%A2%98%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94"><span class="toc-text">butterfly主题问题解答</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#%E6%9B%B4%E5%A4%9A%E9%97%AE%E9%A2%98%E8%A7%A3%E7%AD%94"><span class="toc-text">更多问题解答</span></a></li></ol></li></ol></div></div></div><div class="card-widget card-recent-post"><div class="card-content"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/2021/09/27/%E6%B5%81%E4%BD%93%E6%A8%A1%E6%8B%9F%E4%B8%8ESPH%E6%96%B9%E6%B3%95/" title="流体模拟与SPH方法"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/27/流体模拟与SPH方法/figure1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="流体模拟与SPH方法"/></a><div class="content"><a class="title" href="/2021/09/27/%E6%B5%81%E4%BD%93%E6%A8%A1%E6%8B%9F%E4%B8%8ESPH%E6%96%B9%E6%B3%95/" title="流体模拟与SPH方法">流体模拟与SPH方法</a><time datetime="2021-09-27T08:46:17.000Z" title="发表于 2021-09-27 16:46:17">2021-09-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/" title="弹性有限元方法"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/09/11/弹性有限元方法/figure1.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="弹性有限元方法"/></a><div class="content"><a class="title" href="/2021/09/11/%E5%BC%B9%E6%80%A7%E6%9C%89%E9%99%90%E5%85%83%E6%96%B9%E6%B3%95/" title="弹性有限元方法">弹性有限元方法</a><time datetime="2021-09-11T09:05:34.000Z" title="发表于 2021-09-11 17:05:34">2021-09-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/09/%E5%BC%B9%E7%B0%A7%E8%B4%A8%E7%82%B9%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86/" title="弹簧质点系统与时间积分"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/09/弹簧质点系统与时间积分/figure1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="弹簧质点系统与时间积分"/></a><div class="content"><a class="title" href="/2021/08/09/%E5%BC%B9%E7%B0%A7%E8%B4%A8%E7%82%B9%E7%B3%BB%E7%BB%9F%E4%B8%8E%E6%97%B6%E9%97%B4%E7%A7%AF%E5%88%86/" title="弹簧质点系统与时间积分">弹簧质点系统与时间积分</a><time datetime="2021-08-09T13:39:12.000Z" title="发表于 2021-08-09 21:39:12">2021-08-09</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/08/OpenGL%E5%9D%90%E6%A0%87%E7%B3%BB%E7%BB%9F/" title="OpenGL坐标系统"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/08/OpenGL坐标系统/figure1.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="OpenGL坐标系统"/></a><div class="content"><a class="title" href="/2021/08/08/OpenGL%E5%9D%90%E6%A0%87%E7%B3%BB%E7%BB%9F/" title="OpenGL坐标系统">OpenGL坐标系统</a><time datetime="2021-08-08T12:57:28.000Z" title="发表于 2021-08-08 20:57:28">2021-08-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/2021/08/06/Doxygen%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E6%96%87%E6%A1%A3/" title="Doxygen自动生成文档"><img data-lazy-src="https://cdn.jsdelivr.net/gh/TOMsworkspace/TOMsworkspace.github.io/2021/08/06/Doxygen自动生成文档/Doxygen.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Doxygen自动生成文档"/></a><div class="content"><a class="title" href="/2021/08/06/Doxygen%E8%87%AA%E5%8A%A8%E7%94%9F%E6%88%90%E6%96%87%E6%A1%A3/" title="Doxygen自动生成文档">Doxygen自动生成文档</a><time datetime="2021-08-06T13:24:50.000Z" title="发表于 2021-08-06 21:24:50">2021-08-06</time></div></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2019 - 2021 By Tom</div><div class="framework-info"><span>框架 </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>主题 </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my <a href="https://TOMsworkspace.github.io/">blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">简</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog"></i></button><button id="chat_btn" type="button" title="rightside.chat_btn"><i class="fas fa-sms"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div><script src="https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js"></script><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/medium-zoom/dist/medium-zoom.min.js"></script><script src="https://cdn.jsdelivr.net/npm/instant.page/instantpage.min.js" type="module" defer></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><div class="js-pjax"><script>if (!window.MathJax) {
  window.MathJax = {
    loader: {
      source: {
        '[tex]/amsCd': '[tex]/amscd'
      }
    },
    tex: {
      inlineMath: [ ['$','$'], ["\\(","\\)"]],
      tags: 'ams'
    },
    options: {
      renderActions: {
        findScript: [10, doc => {
          for (const node of document.querySelectorAll('script[type^="math/tex"]')) {
            const display = !!node.type.match(/; *mode=display/)
            const math = new doc.options.MathItem(node.textContent, doc.inputJax[0], display)
            const text = document.createTextNode('')
            node.parentNode.replaceChild(text, node)
            math.start = {node: text, delim: '', n: 0}
            math.end = {node: text, delim: '', n: 0}
            doc.math.push(math)
          }
        }, ''],
        addClass: [200,() => {
          document.querySelectorAll('mjx-container:not([display=\'true\']').forEach( node => {
            const target = node.parentNode
            if (!target.classList.contains('has-jax')) {
              target.classList.add('mathjax-overflow')
            }
          })
        }, '', false]
      }
    }
  }
  
  const script = document.createElement('script')
  script.src = 'https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js'
  script.id = 'MathJax-script'
  script.async = true
  document.head.appendChild(script)
} else {
  MathJax.startup.document.state(0)
  MathJax.texReset()
  MathJax.typeset()
}</script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex@latest/dist/katex.min.css"><script src="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/katex-copytex@latest/dist/katex-copytex.min.css"><script>$(function () {
  $('span.katex-display').wrap('<div class="katex-wrap"></div>')
})</script><script>function addGitalkSource () {
  const ele = document.createElement('link')
  ele.rel = 'stylesheet'
  ele.href= 'https://cdn.jsdelivr.net/npm/gitalk/dist/gitalk.min.css'
  document.getElementsByTagName('head')[0].appendChild(ele)
}

function loadGitalk () {
  function initGitalk () {
    var gitalk = new Gitalk({
      clientID: 'e50742231659674c31e3',
      clientSecret: '59038139e289bc384e484d341205bbb95a123209',
      repo: 'TOMsworkspace.github.io',
      owner: 'TOMsworkspace',
      admin: ['TOMsworkspace'],
      id: '3470d5e34ba078f3abbded55463b89ba',
      language: '-zh-CN# en, zh-CN, zh-TW, es-ES, fr, ru',
      perPage: 10,
      distractionFreeMode: false,
      pagerDirection: 'last',
      createIssueManually: true,
      updateCountCallback: commentCount
    })
    gitalk.render('gitalk-container')
  }

  if (typeof Gitalk === 'function') initGitalk()
  else {
    addGitalkSource()
    $.getScript('https://cdn.jsdelivr.net/npm/gitalk@latest/dist/gitalk.min.js', initGitalk)
  }
}

function commentCount(n){
  let isCommentCount = document.querySelector('#post-meta .gitalk-comment-count')
  if (isCommentCount) {
    isCommentCount.innerHTML= n
  }
}

if ('Gitalk' === 'Gitalk' || !false) {
  if (false) btf.loadComment(document.getElementById('gitalk-container'), loadGitalk)
  else loadGitalk()
} else {
  function loadOtherComment () {
    loadGitalk()
  }
}</script><script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><script id="click-show-text" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/click-show-text.min.js" async="async" mobile="false"></script><script>(function(){
  const bp = document.createElement('script');
  const curProtocol = window.location.protocol.split(':')[0];
  if (curProtocol === 'https'){
  bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else{
  bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
  bp.dataset.pjax = ''
  const s = document.getElementsByTagName("script")[0];
  s.parentNode.insertBefore(bp, s);
})()</script></div></body></html>